# encoding: utf-8
"""
@author: 夏洛
@QQ: 1972386194
@file: 02-login.py
"""

import asyncio
from pyppeteer import launch

async def mains2():
    browser = await launch({'headless': False, 'args': ['--disable-infobars', '--window-size=1920,1080']})
    page = await browser.newPage()
    await page.setViewport({'width': 1920, 'height': 1080})
    await page.goto('https://www.captainbi.com/amz_login.html')
    await page.evaluateOnNewDocument('() =>{ Object.defineProperties(navigator,'
                                     '{ webdriver:{ get: () => false } }) }')
    await page.type('#username', '13555553333')  # 账号
    await page.type('#password', '123456')  # 密码
    await asyncio.sleep(2)
    await page.click('#submit',{'timeout': 3000})
    import time
    # await browser.close()
    print('登录成功')
asyncio.get_event_loop().run_until_complete(mains2())


